package cn.scxy.bookcity.controller;

import cn.scxy.bookcity.pojo.entity.Admin;
import cn.scxy.bookcity.pojo.entity.User;
import cn.scxy.bookcity.pojo.vo.AdminGoodsCateList;
import cn.scxy.bookcity.pojo.vo.UserStandardVO;
import cn.scxy.bookcity.service.AdminGoods;

import cn.scxy.bookcity.service.IAdminUserService;
import cn.scxy.bookcity.web.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/adminuser")
@Api(tags = "管理员用户管理")
@Slf4j
public class AdminUserController {
    @Autowired
    private IAdminUserService service;
    @ApiOperation("查询用户")
    @ApiOperationSupport(order = 300)
    @GetMapping("/list")
    public JsonResult<List<User>> adminSelectGoodsAddNew(){
        List<User> users = service.selectUserList();
        return JsonResult.ok(users);
    }
    @ApiOperation("查询管理员")
    @ApiOperationSupport(order = 300)
    @GetMapping("/adminlist")
    public JsonResult<List<Admin>> adminlist(){
        List<Admin>  a= service.adminlist();
        return JsonResult.ok(a);
    }
    @ApiOperation("删除用户")
    @ApiOperationSupport(order = 300)
    @PostMapping("/delete/{id}")
    public JsonResult<Void> delete(@PathVariable Integer id){
         service.delete(id);
        return JsonResult.ok();
    }
    @ApiOperation("统计用户数量")
    @ApiOperationSupport(order = 300)
    @GetMapping("/selectGoodsCount")
    public JsonResult<Integer> selectGoodsCount(){
        int i = service.selectGoodsCount();
        return JsonResult.ok(i);
    }

}
